import { lazy } from "react";
import { createBrowserRouter, Navigate } from "react-router-dom";
//二级路由
const List = lazy(() => import("../pages/List/List"));
//二级路由配置
export const Homerouter = [
  // {
  //   path: "/",
  //   element: <Navigate to="/List"></Navigate>,
  // },
  {
    path: "/List",
    title: "列表",
    element: <List></List>,
  },
];

//一级路由
const Home = lazy(() => import("../pages/Home/Home"));
const Login = lazy(() => import("../pages/Login/Login"));
const Error = lazy(() => import("../pages/404/Error"));
//一级路由配置
const router = createBrowserRouter([
  {
    path: "/",
    element: <Home></Home>,
    children: Homerouter,
  },
  {
    path: "/Login",
    element: <Login></Login>,
  },
  {
    path: "*",
    element: <Error></Error>,
  },
]);
export default router;
